package com.auto.survey.util.monitoring.dao

import androidx.room.Dao
import androidx.room.Query
import androidx.room.Transaction
import com.auto.survey.util.monitoring.entity.RearIntersectionCalculationResultWithDetails

@Dao
interface CalculationResultDao {

    @Transaction
    @Query("SELECT * FROM MonitoringStationCalculationResult WHERE id = :resultId")
    suspend fun getResultWithDetails(resultId: Long): RearIntersectionCalculationResultWithDetails

    // 查询所有结果及其关联数据
    @Transaction
    @Query("SELECT * FROM MonitoringStationCalculationResult")
    suspend fun getAllResultsWithDetails(): List<RearIntersectionCalculationResultWithDetails>

    // 根据 stationId 查询
    @Transaction
    @Query("SELECT * FROM MonitoringStationCalculationResult WHERE stationId = :stationId")
    suspend fun getResultsByStationId(stationId: Int): List<RearIntersectionCalculationResultWithDetails>
}